#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define N 10

int* getMemFor1DArray(int);
void randFilling(int*, int);
void printArr(int*, int);

int main(void)
{
    srand(time(NULL));

    int *pArr = getMemFor1DArray(N);

    if (NULL != pArr)
    {
        randFilling(pArr, N);
        printArr(pArr, N);

        free(pArr);

        pArr = NULL;
    }
    else
    {
        printf("Memory allocation error!\n");
    }

    return 0;
}

int* getMemFor1DArray(int n)
{
    int *pMem = (int*)malloc(sizeof(int) * n);

    return pMem;
}

void randFilling(int *pMem, int n)
{
    for (int i = 0; i < n; i ++)
    {
        pMem[i] = rand() % 100;
    }

}

void printArr(int *pMem, int n)
{
    for (int i = 0; i < n; i ++)
    {
        printf("%d ", pMem[i]);
    }

    printf("\n");
}
